package com.bawei.library_base.room.paygood;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.bawei.library_base.room.good.GoodDao;
import com.bawei.library_base.room.good.GoodDatabase;

/**
 * @author : zhiyu
 * @date : 2021/12/22
 * @content :
 */

@Database(entities = {PayGood.class},version = 1,exportSchema = false)
public abstract class PayGoodDatabase extends RoomDatabase {
    private  static  final  String DB_NAME = "paygood.db";
    private    static  volatile PayGoodDatabase instance;

   public synchronized static PayGoodDatabase getInstance(Context context){

       if (instance==null){
           instance=Room.databaseBuilder(
                   context,
                   PayGoodDatabase.class,
                   DB_NAME ).allowMainThreadQueries().build();

       }
       return instance;
   }
   public abstract PayGoodDao getPayGoodDao();
}
